package main

import (
	"cgi"
	"fmt"
	"net/http"
)

type Mymux struct {}

func (m *Mymux) ServeHTTP(w http.ResponseWriter, r *http.Request){
	dir := "/Users/xqhero/goproject/goexample/cgi"
	handler := &cgi.Handler{
		Path: fmt.Sprintf(".%s",r.URL.Path),
		Env:  []string{"A=10"},
		Dir:  dir,
	}
	handler.ServeHTTP(w,r)
}

func main()  {
	mux := &Mymux{}
	e := http.ListenAndServe("127.0.0.1:9800", mux)
	if e != nil {
		fmt.Println("server start error", e)
	}
}
